home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _B401D14937AF478F9F04DC1B48B6C79F < prev    next >
Encoding:
Text File  |  2004-01-06  |  7.9 KB  |  215 lines

  1. --------------------------------------------------
  2. --    Created By: Petar
  3. --   Description: This behaviour is called after the guy hears a scary sound. He is aggitated and know that there
  4. --            is imminent danger.
  5. --------------------------
  6. --   modified by: sten 23-10-2002
  7.  
  8. AIBehaviour.CoverThreatened = {
  9.     Name = "CoverThreatened",
  10.  
  11.     ---------------------------------------------
  12.     OnNoTarget = function( self, entity )
  13.         -- called when the enemy stops having an attention target
  14.         entity:Readibility("ENEMY_TARGET_LOST");
  15.         entity:SelectPipe(0,"search_for_target");
  16.     end,
  17.     ---------------------------------------------
  18.     OnPlayerSeen = function( self, entity, fDistance )
  19.         -- called when the enemy sees a living player
  20.  
  21.         entity:Readibility("FIRST_HOSTILE_CONTACT",1);
  22.  
  23.         if (AI:GetGroupCount(entity.id) > 1) then
  24.             -- only send this signal if you are not alone
  25.             entity:SelectPipe(0,"cover_scramble_beacon");
  26.  
  27.             if (entity:NotifyGroup()==nil) then
  28.                 AI:Signal(SIGNALFILTER_SUPERGROUP, 1, "HEADS_UP_GUYS",entity.id);
  29.                 AI:Signal(SIGNALFILTER_SUPERGROUP, 1, "wakeup",entity.id);
  30.             end
  31.  
  32.             entity:SelectPipe(0,"cover_scramble_beacon");
  33.         else
  34.             -- you are on your own
  35.             entity:SelectPipe(0,"cover_scramble");
  36.         end
  37.  
  38.  
  39.         if (entity.RunToTrigger == nil) then
  40.             entity:RunToAlarm();
  41.         end
  42.  
  43.     end,
  44.     ---------------------------------------------
  45.     OnEnemySeen = function( self, entity )
  46.         -- called when the enemy sees a foe which is not a living player
  47.     end,
  48.     ---------------------------------------------
  49.     OnFriendSeen = function( self, entity )
  50.         -- called when the enemy sees a friendly target
  51.     end,
  52.     ---------------------------------------------
  53.     OnDeadBodySeen = function( self, entity )
  54.         -- called when the enemy a dead body
  55.     end,
  56.     ---------------------------------------------
  57.     OnEnemyMemory = function( self, entity )
  58.         -- called when the enemy can no longer see its foe, but remembers where it saw it last
  59.     end,
  60.     ---------------------------------------------
  61.     OnInterestingSoundHeard = function( self, entity )
  62.         -- called when the enemy hears an interesting sound
  63.          entity:SelectPipe(0,"cover_investigate_threat"); 
  64.          entity:InsertSubpipe(0,"DropBeaconAt"); -- in PipeManagerShared.lua
  65.     end,
  66.     OnThreateningSoundHeard = function( self, entity )
  67.         entity:InsertSubpipe(0,"take_cover");
  68.     end,
  69.     ---------------------------------------------
  70.     OnReload = function( self, entity )
  71.         -- called when the enemy goes into automatic reload after its clip is empty
  72.     end,
  73.     ---------------------------------------------
  74.     OnNoHidingPlace = function( self, entity, sender )
  75.         -- called when no hiding place can be found with the specified parameters
  76. --        System:LogToConsole(entity:GetName().." recieved OnNoHidingPlace command in CoverThreatened");
  77.         -- entity:SelectPipe(0,"ApproachSound");
  78.     end,    
  79.     --------------------------------------------------
  80.     OnNoFormationPoint = function ( self, entity, sender)
  81.         -- called when the enemy found no formation point
  82.     end,
  83.     --------------------------------------------------
  84.     OnCoverRequested = function ( self, entity, sender)
  85.         -- called when the enemy is damaged
  86.     end,
  87.     ---------------------------------------------
  88.     OnReceivingDamage = function ( self, entity, sender)
  89.         entity:Readibility("GETTING_SHOT_AT",1);
  90.         entity:InsertSubpipe(0,"hide_sometime");
  91.         
  92.     end,
  93.     ---------------------------------------------
  94.     OnBulletRain = function ( self, entity, sender)    
  95.     end,
  96.  
  97.     ---------------------------------------------
  98.     OnKnownDamage = function ( self, entity, sender)
  99.         -- called when the enemy is damaged
  100.  
  101.         entity:Readibility("GETTING_SHOT_AT",1);
  102.         if (AI:GetGroupCount(entity.id) > 1) then
  103.             AI:Signal(SIGNALFILTER_GROUPONLY, 1, "HEADS_UP_GUYS",entity.id);
  104.         end
  105.  
  106.         entity:SelectPipe(0,"not_so_random_hide_from",sender.id);
  107.         entity:InsertSubpipe(0,"DropBeaconAt",sender.id);
  108.     end,
  109.  
  110.  
  111.     
  112.  
  113.     --------------------------------------------------
  114.     -- CUSTOM SIGNALS
  115.     --------------------------------------------------
  116.     OnGroupMemberDied = function( self, entity, sender)
  117.         -- called when a member of the group dies
  118.  
  119.          if (entity ~= sender) then
  120.             entity:SelectPipe(0,"AIS_PatrolRunNearCoverGoOn");
  121.          end
  122.     end,
  123.     --------------------------------------------------
  124.     OnGroupMemberDiedNearest = function ( self, entity, sender)
  125. --        System:LogToConsole(entity:GetName().." recieved OnGroupMemberDiedNearest signal in CoverThreatened");
  126.         -- called for the nearest when a member of the group dies
  127.         AIBehaviour.DEFAULT:OnGroupMemberDiedNearest(entity,sender);
  128.  
  129.         -- do cover stuff here
  130.         -- investigate corpse
  131.         entity:SelectPipe(0,"RecogCorpse",sender.id);
  132.         
  133.         --entity:SelectPipe(0,"AIS_PatrolRunNearCoverGoOn");
  134.         --entity:InsertSubpipe(0,"DropBeaconAt",sender.id);
  135.         
  136.     end,
  137.     ---------------------------------------------
  138.     Cease = function( self, entity, fDistance )
  139.         entity:SelectPipe(0,"cover_cease_approach"); -- in PipeManagerShared.lua             
  140.     end,
  141.     --------------------------------------------------
  142.     AISF_GoOn = function (self, entity, sender)
  143.         entity:SelectPipe(0,"ApproachSound");
  144.     end,
  145.     --------------------------------------------------
  146.     TRY_TO_LOCATE_SOURCE = function (self, entity, sender)
  147.         entity:SelectPipe(0,"basic_lookingaround");
  148.     end,
  149.     ---------------------------------------------
  150.     -- GROUP SIGNALS
  151.     --------------------------------------------------
  152.     INCOMING_FIRE = function (self, entity, sender)
  153.         if (entity ~= sender) then
  154.             entity:SelectPipe(0,"randomhide");
  155.         end
  156.     end,
  157.     ---------------------------------------------        
  158.     KEEP_FORMATION = function (self, entity, sender)
  159.         -- the team leader wants everyone to keep formation
  160.     end,
  161.     ---------------------------------------------    
  162.     BREAK_FORMATION = function (self, entity, sender)
  163.         -- the team can split
  164.     end,
  165.     ---------------------------------------------    
  166.     SINGLE_GO = function (self, entity, sender)
  167.         -- the team leader has instructed this group member to approach the enemy
  168.     end,
  169.     ---------------------------------------------    
  170.     GROUP_COVER = function (self, entity, sender)
  171.         -- the team leader has instructed this group member to cover his friends
  172.     end,
  173.     ---------------------------------------------    
  174.     IN_POSITION = function (self, entity, sender)
  175.         -- some member of the group is safely in position
  176.     end,
  177.     ---------------------------------------------    
  178.     GROUP_SPLIT = function (self, entity, sender)
  179.         -- team leader instructs group to split
  180.     end,
  181.     ---------------------------------------------    
  182.     PHASE_RED_ATTACK = function (self, entity, sender)
  183.         -- team leader instructs red team to attack
  184.     end,
  185.     ---------------------------------------------    
  186.     PHASE_BLACK_ATTACK = function (self, entity, sender)
  187.         -- team leader instructs black team to attack
  188.     end,
  189.     ---------------------------------------------    
  190.     GROUP_MERGE = function (self, entity, sender)
  191.         -- team leader instructs groups to merge into a team again
  192.     end,
  193.     ---------------------------------------------    
  194.     CLOSE_IN_PHASE = function (self, entity, sender)
  195.         -- team leader instructs groups to initiate part one of assault fire maneuver
  196.     end,
  197.     ---------------------------------------------    
  198.     ASSAULT_PHASE = function (self, entity, sender)
  199.         -- team leader instructs groups to initiate part one of assault fire maneuver
  200.     end,
  201.     ---------------------------------------------    
  202.     GROUP_NEUTRALISED = function (self, entity, sender)
  203.         -- team leader instructs groups to initiate part one of assault fire maneuver
  204.     end,
  205.     ------------------------------------------------------------------------
  206.     ------------------------------ Animation -------------------------------
  207.     target_lost_animation = function (self, entity, sender)
  208.         entity:StartAnimation(0,"enemy_target_lost",0);
  209.     end,
  210.     ------------------------------------------------------------------------
  211.     confused_animation = function (self, entity, sender)
  212.         entity:StartAnimation(0,"_headscratch1",0);
  213.     end,
  214.     ------------------------------------------------------------------------
  215. }